Intro to CSS

Introduction

Why use styles

When HTML was first developed, its purpose was seen simply as placing content and elements on a page without specifying properties for the presentation of those elements, such as colour and size etc. HTML was designed to say "This is a header", "This is a paragraph", "This is a link", by using tags like <h1>, <p>, <a>, and so on. Considerations of styling were left to the browser (by default a white background with black text).

As you can imagine, from a visual point of view this would make things quite plain. During the 90’s, in order to make HTML more versatile and visually appealing, the two main competing browsers, Netscape and Internet Explorer added new HTML tags and attributes, such as the <font> tag and the colour (color) attribute to the original HTML specification. This brought inconsistency to HTML. A situation occurred where certain things would work in one make of browser and not another. It also meant that the original idea of HTML as a tool just for placing elements on a page was being changed to include presentation.

To solve this problem, the World Wide Web Consortium (W3C) - the non profit, standard setting consortium responsible for standardising HTML - created Styles, employed through the use of Cascading Style Sheets (CSS), when HTML 4.0 was introduced.

Think of HTML and Styles like this:

The benefit of styles is that they give greater control of layout for the designer.